Public Class Pager
    Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents hplPager As MyFramework.Web.UI.WebControls.HyperLinkPager
    Protected WithEvents ltrTotal As System.Web.UI.WebControls.Literal

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Public Property PageSize() As Integer
        Get
            Return hplPager.PageSize
        End Get
        Set(ByVal Value As Integer)
            hplPager.PageSize = Value
        End Set
    End Property

    Public Property PageIndex() As Integer
        Get
            Return hplPager.PageIndex
        End Get
        Set(ByVal Value As Integer)
            hplPager.PageIndex = Value
        End Set
    End Property

    Public Property TotalRecords() As Integer
        Get
            Return hplPager.TotalRecords
        End Get
        Set(ByVal Value As Integer)
            hplPager.TotalRecords = Value
        End Set
    End Property


    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' auto-hide if total records = 0
        If TotalRecords = 0 Then
            Me.Visible = False
        End If

        If TotalRecords = 1 Then
            ltrTotal.Text = String.Format("Total: {0} item", TotalRecords)
        ElseIf TotalRecords > 1 Then
            ltrTotal.Text = String.Format("Total: {0} items", TotalRecords)
        End If

    End Sub

End Class
